﻿using Humanizer.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SageKing.MailKit.Features;

public class MailKitFeature : FeatureBase
{
    public MailKitFeature(IModule module) : base(module)
    {
    }

    /// <summary>
    /// Represents the options for MailKits feature.
    /// </summary>
    public Action<EmailOptions> MailKitOptionsAction { get; set; } = _ => { };

    /// <summary>
    /// 
    /// </summary>
    public EmailOptions MailKitOptions { get; set; } = new EmailOptions();

    /// <inheritdoc />
    public override void Apply(IConfigurationManager configurationManager, IHostEnvironment hostEnvironment)
    {
        ArgumentNullException.ThrowIfNull(configurationManager);

        MailKitOptionsAction = (a) => { configurationManager.Bind(a); }; 
        configurationManager.Bind(MailKitOptions);

        Services.Configure(MailKitOptionsAction); 
    }

    public override void Use(IHost app)
    {
        
    }
}
